package com.ymatou.iapi.couponmanage.testcase;

import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.tuple.ImmutablePair;
import org.joda.time.DateTime;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.springframework.beans.factory.annotation.Autowired;

import com.ymatou.iapi.couponmanage.parameter.QueryValidBatchListBean;
import com.ymatou.iapi.couponmanage.parameter.SellerCreateBatchBean;
import com.ymatou.iapi.couponmanage.parameter.ValidBatchInfo;
import com.ymatou.iapi.couponmanage.service.QueryValidBatchListCall;
import com.ymatou.iapi.couponmanage.service.SellerCreateBatchCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CouponServiceMCallServiceV2;
import com.ymttest.database.mapping.couponbatchMapper;
import com.ymttest.database.model.couponbatch;
import com.ymttest.database.sqlwapper.couponbatchWapper;
//import com.ymttest.database.model.couponbatch;
//import com.ymttest.database.sqlwapper.couponbatchWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.MapUtil;
/**
*商家查询有效的优惠券列表用例
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_QueryValidBatchList{
	private static QueryValidBatchListBean queryvalidbatchlistBean;
	private static QueryValidBatchListCall queryvalidbatchlistCall;

	private  couponbatchMapper mapper;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("商家查询有效的优惠券列表用例");
	}

	@Before
	public void caseUp() {
		queryvalidbatchlistBean=new QueryValidBatchListBean();
		queryvalidbatchlistCall=new QueryValidBatchListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(queryvalidbatchlistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_001() {
		Logger.start(true,"商家查询有效的优惠券列表-根据SellerId，BatchCode，BatchName查询");
		try {
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellercreatebatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellercreatebatchBean);
			
			couponbatch batch = new couponbatchWapper().selectBybatchCode(sellerCreateBatchCall.getBatchCode()).get(0);
		
			queryvalidbatchlistBean.setSellerId(batch.getOperatorId());
			queryvalidbatchlistBean.setBatchCode(batch.getBatchCode());
			queryvalidbatchlistBean.setBatchName(batch.getCouponName());
			
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			VerifyReturn();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_002() {
		Logger.start(true,"反例-商家查询有效的优惠券列表-setPageIndex=0,报错");
		try {
			queryvalidbatchlistBean.setSellerId(Integer.valueOf(EnvSetup.getData("SellerId")));
		
			queryvalidbatchlistBean.setPageSize(100);
			queryvalidbatchlistBean.setPageIndex(0);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			 Logger.verifyEquals("0", queryvalidbatchlistCall.getCode(),
		                "验证返回code");
		     
			 Logger.verifyEquals("操作成功！",
		        		queryvalidbatchlistCall.getMessage(), "验证返回Message");
		        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_003() {
		Logger.start(true,"商家查询有效的优惠券列表-PageSize=0,报错(现在正常返回)");
		try {
			
			queryvalidbatchlistBean.setSellerId(Integer.valueOf(EnvSetup.getData("SellerId")));
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(0);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			 Logger.verifyEquals("0", queryvalidbatchlistCall.getCode(),
		                "验证返回code");
		     
			 Logger.verifyIsContains("操作成功！",
		        		queryvalidbatchlistCall.getMessage(), "验证返回Message");
			 Logger.verifyIsContains(0,
					 queryvalidbatchlistCall.getBatchInfos().getBatchInfos().size(), "验证返回batchInfos总条数");
			 
		        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_004() {
		Logger.start(true,"商家查询有效的优惠券列表-PageSize=1,返回一条数据");
		try {
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellercreatebatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellercreatebatchBean);
			CouponServiceMCallServiceV2.SellerCreateBatch(sellercreatebatchBean);
			
			couponbatch batch = new couponbatchWapper().selectBybatchCode(sellerCreateBatchCall.getBatchCode()).get(0);
		
			queryvalidbatchlistBean.setSellerId(batch.getOperatorId());
			
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(1);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			 Logger.verifyEquals("0", queryvalidbatchlistCall.getCode(),
		                "验证返回code");
		     
			 Logger.verifyEquals("操作成功！",
		        		queryvalidbatchlistCall.getMessage(), "验证返回Message");
			 
			 List<ValidBatchInfo> list=queryvalidbatchlistCall.getBatchInfos().getBatchInfos();
			 Logger.verifyEquals(1,
					 list.size(), "验证返回条数");
		        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_005() {
		Logger.start(true,"商家查询有效的优惠券列表-BatchCode非空");
		try {

			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellerCreateBatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellerCreateBatchBean);
			
			CouponServiceMCallServiceV2.CreateDefaultSendCouponBean(sellerCreateBatchBean.getSellerId(), sellerCreateBatchCall.getBatchCode());
			
			queryvalidbatchlistBean.setSellerId(sellerCreateBatchBean.getSellerId());
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);
			queryvalidbatchlistBean.setBatchCode(sellerCreateBatchCall.getBatchCode());
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			 VerifyReturn();
			 
			 Logger.verifyEquals(1,
		        		queryvalidbatchlistCall.getBatchInfos().getBatchInfos().size(), "验证返回条数");
		        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_006() {
		Logger.start(true,"商家查询有效的优惠券列表-BatchName非空");
		try {
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellerCreateBatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellerCreateBatchBean);
			
			CouponServiceMCallServiceV2.CreateDefaultSendCouponBean(sellerCreateBatchBean.getSellerId(), sellerCreateBatchCall.getBatchCode());
	
			queryvalidbatchlistBean.setSellerId(sellerCreateBatchBean.getSellerId());
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);
			queryvalidbatchlistBean.setBatchName(sellerCreateBatchBean.getBatchName());
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			 VerifyReturn();
			 
			 Logger.verifyEquals(1,
		        		queryvalidbatchlistCall.getBatchInfos().getBatchInfos().size(), "验证返回条数");
		        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_007() {
		Logger.start(true,"商家查询有效的优惠券列表-BatchCode非空,BatchName非空");
		try {
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellerCreateBatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellerCreateBatchBean);
			
			CouponServiceMCallServiceV2.CreateDefaultSendCouponBean(sellerCreateBatchBean.getSellerId(), sellerCreateBatchCall.getBatchCode());
	
			queryvalidbatchlistBean.setSellerId(sellerCreateBatchBean.getSellerId());
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);

			queryvalidbatchlistBean.setBatchCode(sellerCreateBatchCall.getBatchCode());
			queryvalidbatchlistBean.setBatchName(sellerCreateBatchBean.getBatchName());
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			 VerifyReturn();
			 
			 Logger.verifyEquals(1,
		        		queryvalidbatchlistCall.getBatchInfos().getBatchInfos().size(), "验证返回条数");
		        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_008() {
		Logger.start(true,"商家查询有效的优惠券列表-BatchCode非空,BatchName非空,BatchCode与BatchName不匹配");
		try {
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellerCreateBatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellerCreateBatchBean);
			
			CouponServiceMCallServiceV2.CreateDefaultSendCouponBean(sellerCreateBatchBean.getSellerId(), sellerCreateBatchCall.getBatchCode());
	
			queryvalidbatchlistBean.setSellerId(sellerCreateBatchBean.getSellerId());
	
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);

			queryvalidbatchlistBean.setBatchCode(sellerCreateBatchCall.getBatchCode());
			queryvalidbatchlistBean.setBatchName(sellerCreateBatchBean.getBatchName()+"2222");
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			 Logger.verifyEquals("0", queryvalidbatchlistCall.getCode(),
		                "验证返回code");
		     
		     Logger.verifyEquals("操作成功！",
		        		queryvalidbatchlistCall.getMessage(), "验证返回Message");
		        
			 Logger.verifyEquals(0,
		        		queryvalidbatchlistCall.getBatchInfos().getBatchInfos().size(), "验证返回条数");
		        
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_009() {
		Logger.start(true,"商家查询有效的优惠券列表-根据SellerId查询");
		try {
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellercreatebatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellercreatebatchBean);
			
			couponbatch batch = new couponbatchWapper().selectBybatchCode(sellerCreateBatchCall.getBatchCode()).get(0);
		
			queryvalidbatchlistBean.setSellerId(batch.getOperatorId());
			
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			VerifyReturn();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_QueryValidBatchList_010() {
		Logger.start(true,"商家查询有效的优惠券列表-根据SellerId查询-分享券不会出现");
		try {
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellercreatebatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setEffectiveEndDate(DateTime.now().plusYears(101).toDate());
			sellercreatebatchBean.setCouponType((byte)2);
			sellercreatebatchBean.setEffectiveDays(2);
		
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellercreatebatchBean);
			
			couponbatch batch = new couponbatchWapper().selectBybatchCode(sellerCreateBatchCall.getBatchCode()).get(0);
		
			queryvalidbatchlistBean.setSellerId(batch.getOperatorId());
			
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			 Logger.verifyEquals("0", queryvalidbatchlistCall.getCode(),
		                "验证返回code");
		     
		        Logger.verifyEquals("操作成功！",
		        		queryvalidbatchlistCall.getMessage(), "验证返回Message");
		        
		        List<ValidBatchInfo> batchList = queryvalidbatchlistCall.getBatchInfos().getBatchInfos();
		        
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 Logger.verifyNotEquals(sellerCreateBatchCall.getBatchCode(),
		        			 batchList.get(i).getBatchCode(), "验证分享券没有返回出来");
				      
		        }
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_012() {
		Logger.start(true,"商家查询有效的优惠券列表-分享券 有效结束时间往后延长100年，变为永久");
		try {
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellercreatebatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setEffectiveEndDate(DateTime.now().plusYears(200).toDate());
			sellercreatebatchBean.setCouponType((byte)2);
			sellercreatebatchBean.setEffectiveDays(2);
			
			
		
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellercreatebatchBean);
			
			couponbatch batch = new couponbatchWapper().selectBybatchCode(sellerCreateBatchCall.getBatchCode()).get(0);
		
			queryvalidbatchlistBean.setSellerId(batch.getOperatorId());
			
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_QueryValidBatchList_011() {
		Logger.start(true,"商家查询有效的优惠券列表-活动优惠券-JIRACONN-23166");
		try {
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellercreatebatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatch_ActivityBean();
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellercreatebatchBean);
			
			couponbatch batch = new couponbatchWapper().selectBybatchCode(sellerCreateBatchCall.getBatchCode()).get(0);
		
			queryvalidbatchlistBean.setSellerId(batch.getOperatorId());
			queryvalidbatchlistBean.setBatchCode(batch.getBatchCode());
			queryvalidbatchlistBean.setBatchName(batch.getCouponName());
			
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			VerifyReturn();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_013() {
		Logger.start(true,"商家查询有效的优惠券列表-仅直播时使用");
		try {
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellercreatebatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponType((byte)4);
			
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellercreatebatchBean);
			
			couponbatch batch = new couponbatchWapper().selectBybatchCode(sellerCreateBatchCall.getBatchCode()).get(0);
		
			queryvalidbatchlistBean.setSellerId(batch.getOperatorId());
			queryvalidbatchlistBean.setBatchCode(batch.getBatchCode());
			queryvalidbatchlistBean.setBatchName(batch.getCouponName());
			
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			VerifyReturn();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_014() {
		Logger.start(true,"商家查询有效的优惠券列表-couponType查询-JIRACONN-26644");
		try {
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellercreatebatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponType((byte)4);
			
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellercreatebatchBean);
			
			couponbatch batch = new couponbatchWapper().selectBybatchCode(sellerCreateBatchCall.getBatchCode()).get(0);
		
			queryvalidbatchlistBean.setSellerId(batch.getOperatorId());
			queryvalidbatchlistBean.setBatchCode(batch.getBatchCode());
			queryvalidbatchlistBean.setBatchName(batch.getCouponName());
			queryvalidbatchlistBean.setCouponType(4);
			
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			VerifyReturn();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryValidBatchList_015() {
		Logger.start(true,"商家查询有效的优惠券列表-batchCode与couponType不匹配-JIRACONN-26644");
		try {
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			SellerCreateBatchBean sellercreatebatchBean = CouponServiceMCallServiceV2.setDefaultSellerCreateBatchBean();
			sellercreatebatchBean.setCouponType((byte)4);
			
			SellerCreateBatchCall sellerCreateBatchCall = CouponServiceMCallServiceV2.SellerCreateBatch(sellercreatebatchBean);
			
			couponbatch batch = new couponbatchWapper().selectBybatchCode(sellerCreateBatchCall.getBatchCode()).get(0);
		
			queryvalidbatchlistBean.setSellerId(batch.getOperatorId());
			queryvalidbatchlistBean.setBatchCode(batch.getBatchCode());
			queryvalidbatchlistBean.setBatchName(batch.getCouponName());
			queryvalidbatchlistBean.setCouponType(1);
			
			queryvalidbatchlistBean.setPageIndex(1);
			queryvalidbatchlistBean.setPageSize(100);
			
			queryvalidbatchlistCall.setData(queryvalidbatchlistBean);
			queryvalidbatchlistCall.callService();			
			
			 Logger.verifyEquals("0", queryvalidbatchlistCall.getCode(),
		                "验证返回code");
		     
		        Logger.verifyEquals("操作成功！",
		        		queryvalidbatchlistCall.getMessage(), "验证返回Message");
		        
		        Logger.verifyEquals(0,
		        		queryvalidbatchlistCall.getBatchInfos().getBatchInfos().size(), "验证返回batchInfos为空");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	private void VerifyReturn() {
        Logger.verifyEquals("0", queryvalidbatchlistCall.getCode(),
                "验证返回code");
     
        Logger.verifyEquals("操作成功！",
        		queryvalidbatchlistCall.getMessage(), "验证返回Message");
        
        List<ValidBatchInfo> batchList = queryvalidbatchlistCall.getBatchInfos().getBatchInfos();
   
        List<Map> DBresult=new couponbatchWapper().pagingGetSellerValidBatches(
        		MapUtil.hashMap("sellerId",queryvalidbatchlistBean.getSellerId(),
				"batchCode",queryvalidbatchlistBean.getBatchCode(),
				"batchName",queryvalidbatchlistBean.getBatchName(),
				"pageIndex",queryvalidbatchlistBean.getPageIndex(),
				"pageSize",queryvalidbatchlistBean.getPageSize()
		));
        int count=new couponbatchWapper().pagingGetSellerValidBatchesCount(
        		MapUtil.hashMap("sellerId",queryvalidbatchlistBean.getSellerId(),
				"batchCode",queryvalidbatchlistBean.getBatchCode(),
				"batchName",queryvalidbatchlistBean.getBatchName(),
				"pageIndex",queryvalidbatchlistBean.getPageIndex(),
				"pageSize",queryvalidbatchlistBean.getPageSize()
		));
        Logger.verifyEquals(count, queryvalidbatchlistCall.getBatchInfos().getBatchInfos().size(),
                "验证返回的数据与数据库是否一致");
        
        for(int i=0;i<batchList.size();i++)
        {
        	Logger.verifyEquals(DBresult.get(0).get("BatchCode").toString(),
        			batchList.get(i).getBatchCode(),
                     "验证返回记录中的BatchCode为传入BatchCode");
        	
        	 String batchCode = batchList.get(i).getBatchCode();
        	 ValidBatchInfo batchInfo = batchList.get(i);
        	 
        	 if(queryvalidbatchlistBean.getBatchCode()!=null)
        	 {
        		 Logger.verifyEquals(queryvalidbatchlistBean.getBatchCode(),
        				 batchInfo.getBatchCode(),
                          "验证返回记录中的BatchCode为传入BatchCode");
        	 }
        	 
        	 if(queryvalidbatchlistBean.getBatchName()!=null)
        	 {
        		 Logger.verifyEquals(queryvalidbatchlistBean.getBatchName(),
        				 batchInfo.getBatchName(),
                          "验证返回记录中的BatchCode为传入BatchCode");
        	 }
        	 
        	Map item = new couponbatchWapper().getCouponBatchByBatchCode(batchCode).get(0);


        	 Logger.verifyEquals(queryvalidbatchlistBean.getSellerId(),
        			 Integer.parseInt(item.get("OperatorId").toString()),
                      "验证返回记录中的iOperatorId为传入sellerid");
        
             Logger.verifyEquals(Integer.parseInt(item.get("BatchId").toString()),
             		batchInfo.getBatchId(),
                     "验证返回BatchCode与数据库中表CouponBatch中BatchCode=" + batchCode
                             + "记录中BatchId字段相同");
             
             Logger.verifyEquals(item.get("CouponName").toString(),
              		batchInfo.getBatchName(),
                      "验证返回BatchCode与数据库中表Ymt_CouponBatch中BatchCode=" + batchCode
                              + "记录中CouponName字段相同");
             
             Logger.verifyEquals(item.get("BatchCode").toString(),
             		batchInfo.getBatchCode(),
                     "验证返回BatchCode与数据库中表Ymt_CouponBatch中BatchCode=" + batchCode
                             + "记录中BatchCode字段相同");

             Logger.verifyEquals(item.get("ValidStart").toString().subSequence(0, 19),
             		batchInfo.getEffectiveStartTime().replace("T", " "),
                     "验证返回getEffectiveStartTime与数据库中表Ymt_CouponSetting中ValidStart字段相同");

             Logger.verifyEquals(item.get("ValidEnd").toString().subSequence(0, 19),
             		batchInfo.getEffectiveEndTime().replace("T", " "),
                     "验证返回getEffectiveEndTime与数据库中表Ymt_CouponSetting中ValidEnd字段相同");
             
           
             Logger.verifyEquals(Integer.parseInt(item.get("TotalNum").toString()),
             		batchInfo.getCouponTotalCount(),
                     "验证返回TotalCount与数据库中表CouponBatch中TotalNum字段相同");
             
             Logger.verifyEquals(Integer.parseInt(item.get("ReceivedCount").toString()),
             		batchInfo.getReceivedCount(),
                     "验证返回BatchCode与数据库中表Ymt_CouponSetting中ReceivedCount字段相同");
             
             Logger.verifyEquals(0,
              		batchInfo.getOrderMinAmount().compareTo(new BigDecimal(item.get("MinOrderValue").toString())),
                      "验证返回BatchCode与数据库中表中MinOrderValue字段相同");
             Logger.verifyEquals(0,batchInfo.getCouponAmount().compareTo(new BigDecimal(item.get("CouponValue").toString())),
                "验证返回BatchCode与数据库中表中CouponValue字段相同");
        
             Logger.verifyEquals(Boolean.parseBoolean(item.get("IsShowInPage").toString()),
              		batchInfo.isShowOnPage(),
                      "验证返回BatchCode与数据库中表Ymt_CouponBatch中IsShowInPage字段相同");
             
             //新增直播相关的
             Logger.verifyEquals(Integer.parseInt(item.get("EffectiveType").toString()),
              		batchInfo.getEffectiveType(),
                      "验证返回EffectiveType与数据库中表CouponBatch中EffectiveType字段相同");
             
             Logger.verifyEquals(Integer.parseInt(item.get("EffectiveTimeType").toString()),
               		batchInfo.getEffectiveTimeType(),
                       "验证返回EffectiveTimeType与数据库中表CouponBatch中EffectiveTimeType字段相同");
             
             Logger.verifyEquals(Integer.parseInt(item.get("EffectiveDays").toString()),
               		batchInfo.getEffectiveDays(),
                       "验证返回EffectiveDays与数据库中表CouponBatch中EffectiveDays字段相同");
             
             Logger.verifyEquals(Integer.parseInt(item.get("EffectiveValidType").toString()),
                		batchInfo.getEffectiveValidType(),
                        "验证返回EffectiveValidType与数据库中表CouponBatch中EffectiveValidType字段相同");
             
             Logger.verifyEquals(Integer.parseInt(item.get("CouponType").toString()),
                		batchInfo.getCouponType(),
                        "验证返回CouponType与数据库中表CouponBatch中CouponType字段相同");
        }

       
    }
}